{template 'web/hairsalon/base_menu'}
<script src="{MODULE_URL}template/resources/highcharts/highcharts.js"></script>
<style>
.topbar1 h3{ font-size:18px; text-align:left; padding:10px 0; font-weight:bold; color:#000;}
.green{color:#0F0;}
.grange{ color:#F60;}
</style>
<script>
function posttest(){
	if(!$("#auth_code").val())return;
	$.post("{php echo $this->createWebUrl('indexs',array('op'=>'test'))}",{auth_code:$("#auth_code").val()},function(returnstr){
		console.log(returnstr);
	});
}
</script>
<div class="panelbox topbar1">
  <div class="panelbox-body" style=" padding:30px">
  	<div class="row">
    	<div class="col-md-4">
        	<div>今日有效订单</div>
            <h3>{$todayItem['num1']}单</h3>
            <div>昨日有效订单 <span>{$yesterdayItem['num1']}</span></div>
            <div>对比：
            {if $todayItem['num1']>$yesterdayItem['num1']}
            	<span class="grange"><i class="fa fa-arrow-up"></i> {php echo $yesterdayItem['num1'] ? intval(($todayItem['num1']-$yesterdayItem['num1'])/$yesterdayItem['num1']*100) : '100'}%</span>
            {elseif $todayItem['num1']<$yesterdayItem['num1']}
            	<span class="green"><i class="fa fa-arrow-down"></i> {php echo $todayItem['num1'] ? intval(($todayItem['num1']-$yesterdayItem['num1'])/$yesterdayItem['num1']*100) : '100'}%</span>
            {else}
            	<span class="green"><i class="fa fa-minus"></i> 持平</span>
            {/if}
          </div>
        </div>
        <div class="col-md-4" style="border-left:1px dashed #CCC;border-right:1px dashed #CCC;">
        	<div>今日订单收入</div>
            <h3><small>￥</small> {php echo sprintf('%.2f',$todayItem['fee']*0.01)}</h3>
            <div>昨日订单收入 ￥{php echo sprintf('%.2f',$yesterdayItem['fee']*0.01)}</div>
            <div>对比：
            {if $todayItem['fee']>$yesterdayItem['fee']}
            	<span class="grange"><i class="fa fa-arrow-up"></i> {php echo $yesterdayItem['fee'] ? intval(($todayItem['fee']-$yesterdayItem['fee'])/$yesterdayItem['fee']*100): '100'}%</span>
            {elseif $todayItem['fee']<$yesterdayItem['fee']}
            	<span class="green"><i class="fa fa-arrow-down"></i> {php echo $todayItem['fee'] ? intval(($todayItem['fee']-$yesterdayItem['fee'])/$yesterdayItem['fee']*100) : '100'}%</span>
            {else}
            	<span class="green"><i class="fa fa-minus"></i> 持平</span>
            {/if}
            </div>
        </div>
        <div class="col-md-4">
        	<div>今日充值</div>
            <h3><small>￥</small> {php echo sprintf('%.2f',$charge_today['fee']*0.01)}</h3>
            <div>昨日充值  ￥{php echo sprintf('%.2f',$charge_yesterday['fee']*0.01)}</div>
            <div>对比：
            {if $charge_today['fee']>$charge_yesterday['fee']}
            	<span class="grange"><i class="fa fa-arrow-up"></i> {php echo $charge_yesterday['fee'] ? intval(($charge_today['fee']-$charge_yesterday['fee'])/$charge_yesterday['fee']*100) : '100'}%</span>
            {elseif $charge_today['fee']<$yesterdayItem['fee']}
            	<span class="green"><i class="fa fa-arrow-down"></i> {php echo $charge_today['fee'] ? intval(($charge_today['fee']-$charge_yesterday['fee'])/$charge_yesterday['fee']*100) : '100'}%</span>
            {else}
            	<span class="green"><i class="fa fa-minus"></i> 持平</span>
            {/if}
            </div>
        </div>
    </div>
  </div>
</div>

<div class="panelbox topbar1">
  <div class="panelbox-head">近7日营业情况</div>
  <div class="panelbox-body">
  	<div id="container" style="width:100%;height:400px"></div>
  </div>
</div>

<script>
var categories=("{php echo $dayStr}").split(',');
var chart = new Highcharts.Chart('container', {
	title: {
        text: '',
        x: 0
    },
    xAxis: {
        categories:categories
    },
    tooltip: {
        valueSuffix: ''
    },
    legend: {
        layout: 'vertical',
        align: 'right',
        verticalAlign: 'middle',
        borderWidth: 0
    },
    series: [{
        name: '订单量',
        data: [{php echo $numstr}]
    }, {
        name: '营业额',
        data: [{php echo $feestr}]
    }]
});
</script>